package com.gaga.console.core.service.impl.ai;

import com.gaga.common.enums.AiModelType;
import com.gaga.console.core.entity.dto.ChatDto;

/**
 * @author liujia
 * @version 1.0
 * @date 2025/4/9-10:03
 */
public class AiFactory {

    public static AiHandler getHandler(ChatDto dto, String polishPrompt) throws Exception {
        AbstractAiHandler aiHandler = null;
        AiModelType aiModelType = AiModelType.getTypeByModelId(dto.getModelId());
        if (aiModelType == null) {
            throw new Exception("暂未支持该模型");
        }
        switch (aiModelType) {
            case Qwen:
                aiHandler = new QwenAiHandler();
                break;
            case Doubao:
                aiHandler = new DoubaoAiHandler();
                break;
            default:
                aiHandler = new DoubaoAiHandler();
                break;
        }
        aiHandler.init(polishPrompt);
        return aiHandler;
    }

}
